Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
irregular-plurals
Advanced tools
The irregular-plurals npm package is designed to provide a simple way to handle irregular plural forms of words in English. It is particularly useful for applications that need to dynamically generate text that conforms to grammatical rules.
Get the plural form of an irregular noun
This feature allows you to retrieve the plural form of an irregular noun. You simply pass the singular form of the noun to the `get` method, and it returns the corresponding plural form.
const irregularPlurals = require('irregular-plurals');
console.log(irregularPlurals.get('mouse')); // Outputs: 'mice'
The pluralize package is similar to irregular-plurals but offers more comprehensive functionality. It not only handles irregular plurals but also correctly pluralizes regular nouns and can revert plurals to their singular form. This makes it more versatile for applications that deal with a broader range of vocabulary.
Inflection is another package that provides similar functionalities to irregular-plurals. It includes methods for pluralizing and singularizing both regular and irregular nouns. Additionally, it supports other string transformations such as camelizing, underscoring, and humanizing, making it suitable for more complex text processing tasks.
Map of nouns to their irregular plural form
An irregular plural in this library is defined as a noun that cannot be made plural by applying these rules:
- If the noun ends in an "s", "x", "z", "ch" or "sh", add "es"
- If the noun ends in a "y" and is preceded by a consonant, drop the "y" and add "ies"
- If the noun ends in a "y" and is preceded by a vowel, add "s"
The list is just a JSON file and can be used anywhere.
$ npm install irregular-plurals
const irregularPlurals = require('irregular-plurals');
console.log(irregularPlurals.get('cactus'));
//=> 'cacti'
console.log(irregularPlurals);
/*
Map {
[addendum, 'addenda'],
[alga, 'algae'],
…
}
*/
FAQs
Map of nouns to their irregular plural form
We found that irregular-plurals demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.